package cn.johnyu.order.client;

import cn.johnyu.commons.dto.ProductDto;
import cn.johnyu.order.config.CustomLoadBalancerConfiguration;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "product-service")
@LoadBalancerClient(name = "product-service",configuration = CustomLoadBalancerConfiguration.class)

public interface ProductClient {
    @GetMapping("/info")
    String info();

    @GetMapping("/products/{id}")
     ProductDto loadProduct(@PathVariable("id") int id);

    @PutMapping("/reduceStock")
    int reduceStock(@RequestParam("id") int id,@RequestParam("count") int count);

}
